<?php

function getKommentare ($match)
{

	include("joomlaInt.php");
	include("inc_configuration.php");
	
	
	$q="SELECT c.kommentar,c.datum,c.matchId,u.username,c.userId FROM $tbl_comments c, $tbl_users u WHERE c.userId=u.id AND matchId=$match ORDER by datum ASC";
	$qe=mysql_query($q);
	$qec=mysql_num_rows($qe);
	
	$out="";
	
	if ($qec>0)
	{
		while ($row=mysql_fetch_object($qe))
		{
			$uname=$row->username;
			$uid=$row->userId;
			$kommentar=$row->kommentar;
			$datum=$row->datum;
			
			$kommentarf=nl2br($kommentar);
			
			$pd=date("d.m.y <br> H:i",$datum);
			
			$out.="	<tr>
						<td><center><a href='profil.php?id=$uid'>$uname</a><br>$pd</center></td>
						<td>$kommentarf</td>
					</tr>";
			
		}
		$out.= "<tr><th></th><th></th></tr>";
	}

	
	return $out;
}


function neuerKommentar ($match,$comment,$user)
{
	include("inc_configuration.php");
	
	$datum=time();
	
	$q="INSERT INTO $tbl_comments (matchId,kommentar,datum,userId) VALUES ($match,'$comment',$datum,$user)";
	$qe=mysql_query($q);
	
	return $q;
}



?>